package com.tbit.uqbike.client.quartz;

import com.tbit.uqbike.client.dao.core.AdaPayConfigDao;
import com.tbit.uqbike.client.pojo.newEntity.AdaPayConfig;
import com.tbit.uqbike.client.remote.adapay.PaymentUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 汇付初始化类定时任务
 *
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2024/9/20
 */
@Slf4j
@Component
public class AdaPayQuartz {

    @Autowired
    private AdaPayConfigDao adaPayConfigDao;

    @Scheduled(cron = "0/30 * * * * ? ")
    @PostConstruct
    public void init(){
//        log.info("执行汇付多商户初始化");
        List<AdaPayConfig> adaPayConfigList = adaPayConfigDao.getAll();
        PaymentUtil.initNew(adaPayConfigList);
    }
}
